package com.cango.framework.base;

import java.io.Serializable;

/**
 * 〈一句话功能简述〉<br> 
 *      ajax返回的包装对象
 *
 * @author myallways
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本] （可选）
 */
public class AjaxReturnVO implements Serializable {
    /**
     * message key
     */
    public static final String MESSAGE_KEY = "message";

    /**
     * <p>
     * Field serialVersionUID: serialVersionUID
     * </p>
     */
    private static final long serialVersionUID = -6840650362280756212L;


    /**
     * <p>
     * Field successCode: 成功代码
     * </p>
     */
    private String code = "1";

    /**
     * <p>
     * Field message: 提示信息
     * </p>
     */
    private String message = "success";

    private AjaxReturnVO() {

    }

    public static AjaxReturnVO success(String message) {
        AjaxReturnVO ajaxObj = new AjaxReturnVO();
        ajaxObj.setCode("1");
        ajaxObj.setMessage(message);
        return ajaxObj;
    }

    public static AjaxReturnVO failed(String message) {
        AjaxReturnVO ajaxObj = new AjaxReturnVO();
        ajaxObj.setCode("0");
        ajaxObj.setMessage(message);
        return ajaxObj;
    }

    public static AjaxReturnVO success() {
        return success("操作成功！");
    }

    public static AjaxReturnVO failed() {
        return failed("操作失败！");
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

}
